package com.example.springboot.mapper;

import com.example.springboot.beans.Student;
import org.apache.ibatis.annotations.*;

//@Mapper//指定这是一个操作数据库的mapper
public interface StudentMapper {
    @Select("select * from student where id=#{id}")
    public Student getStudentById(Integer id);

    @Delete("delete from student where id=#{id}")
    public int deleteStudentById(Integer id);

    @Options(useGeneratedKeys = true,keyProperty = "id")
    @Insert("insert into student(name,age) values(#{name},#{age})")
    public int insertStudent(Student stu);

    @Update("update student set address=#{address} where id=#{id}")
    public int updateStudent(Student stu);
}
